#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 15;
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int arr[N][N];
int main()
{
    int n;
    cin >> n;
    int as = 1;
    int x = 1, y = 1;
    int bf = 0;
    while (as <= n * n)
    {
        arr[x][y] = as;
        int a = x + dx[bf];
        int b = y + dy[bf];
        if (a > n || a<1 || b>n || b < 1 || arr[a][b])
        {
            bf = (bf + 1) % 4;
            a = x + dx[bf];
            b = y + dy[bf];
        }
        x = a;
        y = b;
        as++;
    }
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            printf("%3d", arr[i][j]);
        }
        puts("");
    }

    return 0;
}